<?xml version="1.0" encoding="UTF-8"?>
<ui:composition xmlns="http://www.w3.org/1999/xhtml"
      xmlns:h="http://java.sun.com/jsf/html"
      xmlns:f="http://java.sun.com/jsf/core"
      xmlns:p="http://primefaces.prime.com.tr/ui"
      xmlns:ui="http://java.sun.com/jsf/facelets">

    <h3>My categories</h3>
    <h:form>
        <p:dataTable var="c" value="#{CategoryBean.categories}">
            <p:column sortBy="#{c.title}">
                <f:facet name="header">
                    <h:outputText value="Name" />
                </f:facet>
                <h:outputText value="#{c.title}" />
            </p:column>

            <p:column sortBy="#{c.created}">
                <f:facet name="header">
                    <h:outputText value="Date Added" />
                </f:facet>
                <h:outputText value="#{c.created}" />
            </p:column>
	    
	    <p:column>
		<a href="manage?id=#{c.id}">Edit</a>
	    </p:column>
	    <p:column>
		<h:commandButton action="#{testController.takeTest(c)}"
                                 styleClass="button" value="Take test" />
	    </p:column>
            <p:column>
		<h:commandButton action="#{testController.remove(c)}"
                                 styleClass="confirmButton" value="Remove" />
	    </p:column>
        </p:dataTable>
    </h:form>

    </ui:composition>